﻿<template>
    <el-input v-model="currentValue"
              type="password"
              :placeholder="$t(placeholder)"
              :autocomplete="autocomplete"
              :disabled="disabled"></el-input>
</template>

<script>
export default {
  data () {
    return {
      currentValue: this.value === undefined || this.value === null
        ? ''
        : this.value
    }
  },
  props: {
    value: [String, Number],
    autocomplete: String,
    placeholder: String,
    disabled: Boolean
  },
  watch: {
    value (newVal) {
      this.currentValue = newVal
    },
    currentValue (newVal) {
      this.currentValue = newVal

      if (this.value != newVal) {
        this.$emit('input', newVal)
      }
    }
  }
}
</script>
